{% extends 'master.html' %}
{% load static %}
{% block content %}
    <link href="{% static "css/index.css" %}" rel="stylesheet" type="text/css" media="all"/>
    <div style="height:10px;"></div>
    {% if request.user.is_authenticated %}
        <div class="news-content clearfix">
            <div class="news-content-fix">
                <div class="news-content-item clearfix">
                    <a href="javascript:;" class="news-content-title  clearfix">
                        <div class="news-title-fl  clearfix">
                            <div class="news-title-color"></div>
                            <div class="news-title-title">推荐新闻</div>
                        </div>
                        <div class="news-title-fr news-title-img01"></div>
                    </a>
                    <ul class="news-content-lists clearfix">
                        {% if not recommend %}
                            <span>还没有能推荐的新闻哦</span>
                        {% endif %}
                        {% if recommend %}
                            {% for article in recommend %}
                                <li class="clearFix">
                                    <a href="{% url 'newsrecommand:news' article.article_id %}">
                                        <span>{{ article.title }}</span>
                                    </a>
                                </li>
                            {% endfor %}
                        {% endif %}
                    </ul>
                </div>

                <div class="news-content-item clearfix">
                    <a href="javascript:;" class="news-content-title  clearfix">
                        <div class="news-title-fl  clearfix">
                            <div class="news-title-color"></div>
                            <div class="news-title-title">浏览记录</div>
                        </div>
                        <div class="news-title-fr news-title-img01"></div>
                    </a>
                    <ul class="news-content-lists clearfix">
                        {% if not request.user.viewed %}
                            <span>还没有浏览过新闻哦</span>
                        {% endif %}
                        {% if request.user.viewed %}
                            {% for article in viewed %}
                                <li class="clearFix">
                                    <a href="{% url 'newsrecommand:news' article.article_id %}">
                                        <span>{{ article.title }}</span>
                                    </a>
                                </li>
                            {% endfor %}
                        {% endif %}
                    </ul>
                </div>
            </div>
        </div>
    {% endif %}

    <!--main-->
    <div class="news_1">
        <div class="left">
            <div class="left_1">
                <h2><a href="{% url 'newsrecommand:type' 1 %}">论文专利</a></h2>
                <table>
                    {% for article in type1 %}
                        <tr>
                            <td style="text-align: left"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.title }}</a>
                            </td>
                            <td style="text-align: right"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.date }}</a>
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
            <div class="left_2" style="border-left: #dc2b2b solid 1px">
                <h2><a href="{% url 'newsrecommand:type' 2 %}">校园活动</a></h2>
                <table>
                    {% for article in type2 %}
                        <tr>
                            <td style="text-align: left"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.title }}</a>
                            </td>
                            <td style="text-align: right"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.date }}</a>
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
            <div class="left_3">
                <h2><a href="{% url 'newsrecommand:type' 3 %}">大赛通知</a></h2>
                <table>
                    {% for article in type3 %}
                        <tr>
                            <td style="text-align: left"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.title }}</a>
                            </td>
                            <td style="text-align: right"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.date }}</a>
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
            <div class="left_4" style="border-left: #dc2b2b solid 1px">
                <h2><a href="{% url 'newsrecommand:type' 4 %}">工作安排</a></h2>
                <table>
                    {% for article in type4 %}
                        <tr>
                            <td style="text-align: left"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.title }}</a>
                            </td>
                            <td style="text-align: right"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.date }}</a>
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
            <div class="left_5">
                <h2><a href="{% url 'newsrecommand:type' 5 %}">讲座会议</a></h2>
                <table>
                    {% for article in type5 %}
                        <tr>
                            <td style="text-align: left"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.title }}</a>
                            </td>
                            <td style="text-align: right"><a
                                    href="{% url 'newsrecommand:news'  article.article_id %}">{{ article.date }}</a>
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </div>

    </div>

{% endblock %}